﻿#include "FITKAbaFieldOutput.h"
#include <QMetaEnum>
#include "FITKAbaStepManager.h"
#include "FITKAbaAbstractStep.h"
#include "FITKAbaOutputDefaultVariablesManager.h"


bool Interface::FITKAbaFieldOutput::getExteriorOnly() const
{
    return m_exteriorOnly;
}

void Interface::FITKAbaFieldOutput::setExteriorOnly(bool state)
{
    m_exteriorOnly = state;
}

QVector<QVector<QString>> Interface::FITKAbaFieldOutput::getAllVariablesWithParents(FITKAbaAbstractStep::FITKAbaStepType stepType, 
    FITKAbaOutputVariable::OutputDomain domain)
{
    QVector<QVector<QString>> vars{};
    QStringList allVars = FITKAbaOutputDefaultVariablesManager::getInstance()->getAllDefaultFieldVaraibles(stepType, domain);
    for (const QString& var : allVars)
    {
        QStringList parents = FITKAbaOutputVariable::getVariableParents(var);
        QVector<QString> vStrs{var,};
        for (const QString& parent : parents)
        {
            vStrs.push_front(parent);
        }
        vars.push_back(vStrs);
    }
    return vars;
}

QStringList Interface::FITKAbaFieldOutput::getAllVariables(FITKAbaAbstractStep::FITKAbaStepType stepType,
    FITKAbaOutputVariable::OutputDomain domain)
{
    QStringList allVars = FITKAbaOutputDefaultVariablesManager::getInstance()->getAllDefaultFieldVaraibles(stepType, domain);
    return allVars;
}

QStringList Interface::FITKAbaFieldOutput::getPreselectedVariables(FITKAbaAbstractStep::FITKAbaStepType stepType, 
    FITKAbaOutputVariable::OutputDomain domain)
{
    QStringList allVars = FITKAbaOutputDefaultVariablesManager::getInstance()->getPreSelectedDefaultFeildVaraiables(stepType, domain);
    return allVars;
}

QString Interface::FITKAbaFieldOutput::getVariableDescription(const QString& var)
{
    return FITKAbaOutputVariable::getVariableDescription(var);
}

Interface::FITKAbaAbstractOutput::FITKAbaOutputType Interface::FITKAbaFieldOutput::getOutputType() const
{
    return FITKAbaOutputType::Field;
}

bool Interface::FITKAbaFieldOutput::copy(FITKAbstractDataObject *obj)
{
    bool ok = FITKAbaAbstractOutput::copy(obj);
    if (!ok)
        return false;
    FITKAbaFieldOutput* output = dynamic_cast<FITKAbaFieldOutput*>(obj);
    if (output == nullptr)
        return false;
    this->m_exteriorOnly = output->m_exteriorOnly;
    this->m_includeLocalCoordDirWhenAvailable = output->m_includeLocalCoordDirWhenAvailable;
    return true;
}

bool Interface::FITKAbaFieldOutput::getIncludeLocalCoordDirWhenAvailable() const
{
    return m_includeLocalCoordDirWhenAvailable;
}

void Interface::FITKAbaFieldOutput::setIncludeLocalCoordDirWhenAvailable(bool value)
{
    m_includeLocalCoordDirWhenAvailable = value;
}

